﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace EggOfPanKu.Library.Infrastructure
{
    public static class CardManager
    {
        /// <summary>
        /// Static method that strips out certain string symbols and converts the resulting object into an integer
        /// </summary>
        /// <param name="value">Value to convert</param>
        /// <returns>Integer that was converted from the value</returns>
        public static int ConvertCardValueToInt(string value)
        {
            int cardValueAsInt = 0;
            try
            {
                value = value.Replace("+", "");
                value = value.Replace("*", "");
                //value = value.Replace("-", "");
                value = value.Replace(" ", "");
                value = value.Replace(".", "");

                if (value.Length > 0)
                {
                    cardValueAsInt = Convert.ToInt32(value);
                }
                return cardValueAsInt;
            }
            catch
            {
                return cardValueAsInt;
            }
        }
    }
}
